
//
//  MomentClient.m
//  WeChatMoments
//
//  Created by Jiang on 2019/8/25.
//  Copyright © 2019 SilverFruity. All rights reserved.
//

#import "UserRelatedClient.h"
@implementation Pagination

@end

@interface UserRelatedClient()
@property (nonatomic, strong)SFHTTPClient *client;
@end

@implementation UserRelatedClient

- (instancetype)init
{
    self = [super init];
    self.client = [[SFHTTPClient alloc] initWithBaseUrl:[NSURL URLWithString:@"http://thoughtworks-ios.herokuapp.com/user/"]];
    self.client.requestGenerator = [SFRequestJSONSerializer new];
    return self;
}

- (void)getMomentListWithUserName:(NSString *)usename
                           plugin:(nullable id <SFPlugin>)plugin
                       completion:(SFHTTPHandler)completion{
    SFMapModelPlugin *mapPlugin = [SFMapModelPlugin pluginWithModelClass:MomentItem.class];
    plugin = plugin ? plugin.addNext(mapPlugin) : mapPlugin;
    NSString *url = [NSString stringWithFormat:@"%@/tweets",usename];
    [self.client requestWithMethod:@"GET" url:url parameters:nil plugin:plugin completion:completion];
}

- (void)getUserInfoWithUserName:(NSString *)username plugin:(id<SFPlugin>)plugin completion:(SFHTTPHandler)completion{
    [self.client requestWithMethod:@"GET" url:username parameters:nil plugin:plugin completion:completion];
}

@end
